<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>焦点事件</title>
</head>
<body>
<input type="text" onfocus="fn1()" onblur="fn2()">
<input type="text" onfocus="fn3()" onblur="fn4()">
</body>
<script>

    function fn1() {
        console.log("input1 获取焦点");
    }
    function fn2() {
        console.log("input1 失去焦点");
    }
    function fn3() {
        console.log("input2 获取焦点");
    }
    function fn4() {
        console.log("input2 失去焦点");
    }
</script>
</html>